/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hetgrotemvcproject;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

/**
 * FXML Controller class
 *
 * @author student
 */
public class MainViewController implements Initializable {
    @FXML
    private  TextField title;
    @FXML
    private ChoiceBox<ReminderPriority> priority;
    @FXML
    private TextArea description;
    
    /**
     * Initializes the controller class.
     */
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        title.textProperty().bindBidirectional(Model.getInstance().titleProperty());
        priority.setItems(FXCollections.observableArrayList(ReminderPriority.values()));
        priority.valueProperty().bindBidirectional(Model.getInstance().priorityProperty());
        description.textProperty().bindBidirectional(Model.getInstance().titleProperty());
    }    
    public void save(){
        Model.getInstance().cancel();
    }
    public void cancel(){
        Model.getInstance().save();
    }
    
}
